﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace BtoBSWT315
{
    public partial class TJ_News : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetXGXX_BtobNewsViewDataBind();
        }

        private void GetXGXX_BtobNewsViewDataBind()
        {
            //定义所需sql语句
            Admin.Admin_ClassDb classdb = new Admin.Admin_ClassDb();
            string sql1 = "select top 15 NewsID,TypeName,typeid,Title from hyxx where Tjnews=1 order by hits desc,newsid desc";

            DataTable dataTable = classdb.GetTables(sql1);
            if (dataTable != null)
            {
                //取得结果值
                DataList1.DataSource = dataTable.DefaultView;
                DataList1.DataBind();
            }
        }
        protected string GetTitle(string Title)
        {
            if (Title.Length > 13)
            {
                Title = Title.Substring(0, 13);
            }
            return Title;
        }

    }
}